<!DOCTYPE HTML PUBdtC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>oscP5 : : OscMessage : : add ( )</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
document.getElementsByTagName('html')[0].className = 'isjs';

function toggle(dt) 
{ 
  var display, dd=dt; 
  /* get dd */ 
  do{ dd = dd.nextSibling } while(dd.tagName!='DD'); 
  toOpen =!dd.style.display; 
  dd.style.display = toOpen? 'block':'' 
  dt.getElementsByTagName('span')[0].innerHTML 
    = toOpen? '-':'+' ; 
} 
</script>
</head>
<body>
<div id="container">
	<div id="header">
	<a href="./index.htm"><img src="./docuImages/title.jpg" /></a>
	</div>
	<div class="content">
	<h1><a href="index.htm">oscP5</a> / <a href="OscMessage_class_OscMessage.htm">OscMessage</a> / add( )</h1>
		<div class="separator">
		<dl><dt class="key">name</dt><dd class="value">add ( )</dd></dl>
		</div>
		<dl><dt class="key">description</dt><dd class="value">add values to an osc message. please check the
 add documentation for specific information.&nbsp;</dd></dl>
		
		<div class="toggleList example">
			<dl><dt onclick="toggle(this)"><span>+</span>Examples</dt>
			<dd><pre>/**
 * oscP5message by andreas schlegel
 * example shows how to create osc messages.
 * oscP5 website at http://www.sojamo.de/oscP5
 */
 
import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress myRemoteLocation;

void setup() {
  size(400,400);
  frameRate(25);
  /* start oscP5, listening for incoming messages at port 12000 */
  oscP5 = new OscP5(this,12000);
  
  /* myRemoteLocation is a NetAddress. a NetAddress takes 2 parameters,
   * an ip address and a port number. myRemoteLocation is used as parameter in
   * oscP5.send() when sending osc packets to another computer, device, 
   * application. usage see below. for testing purposes the listening port
   * and the port of the remote location address are the same, hence you will
   * send messages back to this sketch.
   */
  myRemoteLocation = new NetAddress("127.0.0.1",12000);
}


void draw() {
  background(0);  
}

void mousePressed() {
  /* in the following different ways of creating osc messages are shown by example */
  OscMessage myMessage = new OscMessage("/test");
  
  myMessage.add(123); /* add an int to the osc message */
  myMessage.add(12.34); /* add a float to the osc message */
  myMessage.add("some text"); /* add a string to the osc message */
  myMessage.add(new byte[] {0x00, 0x01, 0x10, 0x20}); /* add a byte blob to the osc message */
  myMessage.add(new int[] {1,2,3,4}); /* add an int array to the osc message */

  /* send the message */
  oscP5.send(myMessage, myRemoteLocation); 
}


/* incoming osc message are forwarded to the oscEvent method. */
void oscEvent(OscMessage theOscMessage) {
  /* print the address pattern and the typetag of the received OscMessage */
  print("### received an osc message.");
  print(" addrpattern: "+theOscMessage.addrPattern());
  println(" typetag: "+theOscMessage.typetag());
}
</pre></dd>
			</dl>
		</div>
		
		<div class="separator">
		<dl><dt class="key">Syntax</dt><dd class="value"><pre>add();
add(theValue);
add(channel, status, value1, value2);
add(theArray);
</pre></dd></dl>
		</div>
		<div class="separator">
		
   <dl><dt class="key">parameters</dt><dd class="value"><span class="parameters">theValue</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theValue</span><span class="parameters">String</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theValue</span><span class="parameters">float</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theValue</span><span class="parameters">double</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theValue</span><span class="parameters">boolean</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theValue</span><span class="parameters">Boolean</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theValue</span><span class="parameters">Integer</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theValue</span><span class="parameters">Float</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theValue</span><span class="parameters">Double</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theValue</span><span class="parameters">Character</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theValue</span><span class="parameters">char</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">channel</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">status</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">value1</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">value2</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theArray</span><span class="parameters">int[]</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theArray</span><span class="parameters">char[]</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theArray</span><span class="parameters">float[]</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theArray</span><span class="parameters">String[]</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theArray</span><span class="parameters">byte[]</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theArray</span><span class="parameters">Object[]</span><span class="clear">&nbsp;</span></dd>
</dl>
		<br /><br />
		</div>
		<div class="separator">
		<dl><dt class="key">Returns</dt><dd class="value">None</dd></dl>

		</div>
		<div class="separator">
		<dl><dt class="key">Usage</dt><dd class="value">Web & Application</dd></dl>
		</div>
		<div class="separator">
		<dl><dt class="key">Related</dt><dd class="value"><ul></ul></dd></dl>
		</div>
	</div>
	<div id="footer">
<p>by andreas schlegel (<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank">cc</a>) 2007, <a href="http://www.sojamo.de" target="_blank">sojamo</a>.</p>
</div>

</div>
</body>
</html>